home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / pcl4p51.zip / PCL4PREF.DOC < prev    next >
Text File  |  1996-06-05  |  66KB  |  1,565 lines

  1.  
  2.  
  3.                                Personal Communications Library
  4.  
  5.                                      For Borland/Turbo Pascal
  6.  
  7.  
  8.                                          ( PCL4P )
  9.  
  10.  
  11.  
  12.                                     REFERENCE MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                        Version  5.1
  19.  
  20.                                        June 5, 1996
  21.  
  22.  
  23.  
  24.  
  25.                              This software is provided as-is.
  26.                       There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                                    Copyright (C) 1996
  32.                                    All rights reserved
  33.  
  34.  
  35.  
  36.                                    MarshallSoft Computing, Inc.
  37.                                    Post Office Box 4543
  38.                                    Huntsville AL 35815
  39.  
  40.                                  Voice : 205-881-4630
  41.                                    FAX : 205|880|0925
  42.                                    BBS : 205-880-9748
  43.                                  email : help@marshallsoft.com
  44.                               Anon FTP : ftp.marshallsoft.com
  45.                                    web : www.marshallsoft.com
  46.  
  47.  
  48.  
  49.                                             _______
  50.                                        ____|__     |                (R)
  51.                                     --+       |    +-------------------
  52.                                       |   ____|__  |  Association of
  53.                                       |  |       |_|  Shareware
  54.                                       |__|   o   |    Professionals
  55.                                     --+--+   |   +---------------------
  56.                                          |___|___|    MEMBER
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.              PCL4P Reference Manual                                            Page 1
  69.                                      C O N T E N T S
  70.  
  71.  
  72.  
  73.  
  74.  
  75.                    Chapter                                                 Page
  76.  
  77.                    Table of Contents......................................2
  78.                    Introduction...........................................3
  79.                       SioBaud.............................................4
  80.                       SioBrkKey...........................................4
  81.                       SioBrkSig...........................................5
  82.                       SioCTS..............................................5
  83.                       SioDCD..............................................6
  84.                       SioDelay............................................6
  85.                       SioDone.............................................7
  86.                       SioDSR..............................................7
  87.                       SioDTR..............................................8
  88.                       SioError............................................8
  89.                       SioFIFO.............................................9
  90.                       SioFlow.............................................9
  91.                       SioGetc............................................10
  92.                       SioGetDiv..........................................10
  93.                       SioInfo............................................11
  94.                       SioIRQ.............................................11
  95.                       SioLine............................................12
  96.                       SioLoopBack........................................12
  97.                       SioModem...........................................13
  98.                       SioParms...........................................13
  99.                       SioPorts...........................................14
  100.                       SioPutc............................................14
  101.                       SioRead............................................15
  102.                       SioReset...........................................15
  103.                       SioRI..............................................16
  104.                       SioRTS.............................................16
  105.                       SioRxBuf...........................................17
  106.                       SioRxClear.........................................17
  107.                       SioRxQue...........................................18
  108.                       SioTimer...........................................18
  109.                       SioTxBuf...........................................19
  110.                       SioTxClear.........................................19
  111.                       SioTxFlush.........................................20
  112.                       SioTxQue...........................................20
  113.                       SioUART............................................21
  114.                       SioUnGetc..........................................21
  115.                    Function Summary......................................22
  116.                    Error Code Summary....................................23
  117.                    Example Code..........................................23
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.              PCL4P Reference Manual                                            Page 2
  137.                                   Introduction
  138.  
  139.  
  140.               This  manual  lists  all  the  PCL4P  functions in alphabetical order. Every
  141.               library function will return a value as follows:
  142.  
  143.               1.  Negative values for error conditions. See last page of this manual for a
  144.               list of error values and their meanings.
  145.  
  146.               2.  Non-negative values when returning data ( eg: SioLine ).
  147.  
  148.               3.  Zero otherwise.
  149.  
  150.               When debugging an application, be  sure  to  test  all  return  values.  Use
  151.               SioError to print the associated text for errors.
  152.  
  153.  
  154.               Example Code Segment
  155.  
  156.               +--------------------------------------------------------+
  157.               |  RetCode := SioFunction();    (* any PCL4P function *) |
  158.               |  if RetCode < 0 then begin                             |
  159.               |    RetCode := SioError(RetCode);                       |
  160.               |    (* ...do some stuff... *)                           |
  161.               |    end;                                                |
  162.               +--------------------------------------------------------+
  163.  
  164.  
  165.               Examine  PCL4P.PAS  for  a  listing of constants, functions, and procedures.
  166.               Examine PCL4P16.PAS for the protected mode version.
  167.  
  168.               For more examples, examine each of the example programs in the  distribution
  169.               zip-file.
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.              PCL4P Reference Manual                                            Page 3
  205.               +-------------+------------------------------------------------------------+
  206.               |   SioBaud   |  Sets the baud rate of the selected port.                  |
  207.               +-------------+------------------------------------------------------------+
  208.  
  209.  
  210.                 Syntax    function SioBaud(Port,BaudCode:Integer):Integer;
  211.                           (* Port:      Port selected (COM1 thru COM20) *)
  212.                           (* BaudCode:  Baud code *)
  213.  
  214.                Remarks    The  SioBaud  function sets the baud rate without resetting  the
  215.                           port. It is used to change the baud rate after calling SioReset.
  216.  
  217.                            Code   Rate    Name             Code   Rate   Name
  218.                              0     300    Baud300            5    9600   Baud9600
  219.                              1     600    Baud600            6   19200   Baud19200
  220.                              2    1200    Baud1200           7   38400   Baud38400
  221.                              3    2400    Baud2400           8   57600   Baud57600
  222.                              4    4800    Baud4800           9  115200   Baud115200
  223.  
  224.  
  225.                Returns     -4 : No such port. Expect 0 to MaxPort.
  226.                           -11 : Bad baud rate code. See above code values.
  227.                          >= 0 : OK
  228.  
  229.               See Also    SioReset
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.               +-------------+------------+-------------------+---------------------------+
  239.               |  SioBrkKey  |  Return non|zero if the Control|Break key was pressed.     |
  240.               +-------------+------------+-------------------+---------------------------+
  241.  
  242.  
  243.                 Syntax    function SioBrkKey:Integer;
  244.  
  245.                Remarks    The  SioBrkKey  function returns a TRUE value (non-zero) if  the
  246.                           Control-BREAK key was pressed,  else  it  returns  a  zero.  Use
  247.                           SioBrkKey  as  a safety exit from a polling loop. Don't mix this
  248.                           function up with SioBrkSig.
  249.  
  250.                Returns   <> 0 : Control-BREAK was pressed.
  251.                             0 : Control-BREAK was NOT pressed.
  252.  
  253.               See Also    SioBrkSig
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.              PCL4P Reference Manual                                            Page 4
  273.               +-------------+------------------------------------------------------------+
  274.               |  SioBrkSig  |  Asserts, cancels, or detects BREAK signal.                |
  275.               +-------------+------------------------------------------------------------+
  276.  
  277.  
  278.                 Syntax    function SioBrkSig(Port:Integer;Cmd:Char):Boolean;
  279.                           (* Port:      Port selected (COM1 thru COM20) *)
  280.                           (* char Cmd:  ASSERT, CANCEL, or DETECT *)
  281.  
  282.                Remarks    The SioBrkSig function controls the BREAK bit in the line status
  283.                           register. The legal commands are:
  284.  
  285.                           ASSERT_BREAK ('A') to assert BREAK
  286.                           CANCEL_BREAK ('C') to cancel BREAK
  287.                           DETECT_BREAK ('D') to detect BREAK
  288.  
  289.                           ASSERT_BREAK, CANCEL_BREAK,  and  DETECT_BREAK  are  defined  in
  290.                           PCL4P.PAS. See TERM.PAS for an example of the use of SioBrkSig.
  291.  
  292.                Returns    -2 : Port not enabled. Call SioReset first.
  293.                           -4 : No such port. Expect 0 to MaxPort.
  294.                           -6 : Illegal command. Expected 'A', 'C', or 'D'.
  295.                           >0 : BREAK signal detected (DETECT command only)
  296.  
  297.               See Also    SioBrkKey
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.               +-------------+------------------------------------------------------------+
  306.               |   SioCTS    |  Reads the Clear to Send (CTS) modem status bit.           |
  307.               +-------------+------------------------------------------------------------+
  308.  
  309.                 Syntax    function SioCTS(Port:Integer):Integer;
  310.                           (* int Port: Port selected (COM1 thru COM20) *)
  311.  
  312.                Remarks    The SioCTS function is used to read  the  Clear  to  Send  (CTS)
  313.                           modem status bit.
  314.  
  315.                           The  CTS  line  is  used  by  some  error  correcting  modems to
  316.                           implement hardware flow control.  CTS is dropped by the modem to
  317.                           signal the computer not to send data  and is  raised  to  signal
  318.                           the computer to continue.
  319.  
  320.                           Refer to the User's Manual for a discussion of flow control.
  321.  
  322.                Returns    -2 : Port not enabled. Call SioReset first.
  323.                           -4 : No such port.  Expect 0 to MaxPort.
  324.                            0 : CTS is clear.
  325.                           >0 : CTS is set.
  326.  
  327.               See Also    SioFlow, SioDSR, SioRI, SioDCD, and SioModem.
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.              PCL4P Reference Manual                                            Page 5
  341.               +-------------+------------------------------------------------------------+
  342.               |   SioDCD    |  Reads the Data Carrier Detect (DCD) modem staus bit.      |
  343.               +-------------+------------------------------------------------------------+
  344.  
  345.  
  346.                 Syntax    function SioDCD(Port:Integer):Integer;
  347.                           (* Port: Port selected (COM1 thru COM20) *)
  348.  
  349.                Remarks    The  SioDCD  function is  used to read the Data Carrier Detect
  350.                           (DCD) modem status bit. Also see SioModem.
  351.  
  352.                Returns    -2 : Port not enabled. Call SioReset first.
  353.                           -4 : No such port.  Expect 0 to MaxPort.
  354.                            0 : DCD is clear.
  355.                           >0 : DCD is set.
  356.  
  357.               See Also    SioDSR, SioCTS, SioRI, and SioModem.
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.               +-------------+------------------------------------------------------------+
  371.               |   SioDelay  |  Delays one or more timer tics.                            |
  372.               +-------------+------------------------------------------------------------+
  373.  
  374.  
  375.                 Syntax    function SioDelay(Tics:Integer):Integer;
  376.                           (* Tics: # timer tics to delay *)
  377.  
  378.                Remarks    The  SioDelay  function is used to delay one or more timer tics,
  379.                           where each timer tic is approximately 55 milliseconds (18.2 tics
  380.                           to the second).
  381.  
  382.                Returns    zero.
  383.  
  384.               See Also    SioTimer
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.              PCL4P Reference Manual                                            Page 6
  409.               +-------------+------------------------------------------------------------+
  410.               |   SioDone   |  Terminates further serial processing.                     |
  411.               +-------------+------------------------------------------------------------+
  412.  
  413.  
  414.                 Syntax    function SioDone(Port:Integer):Integer;
  415.                           (* Port: Port selected (COM1 thru COM20) *)
  416.  
  417.                Remarks    The  SioDone  function  terminates  further  serial  processing.
  418.                           SioDone  MUST  be called before exiting your application so that
  419.                           interrupts can be restored to their original state.  Failure  to
  420.                           do  this  can crash the operating system.  If you forget to call
  421.                           SioDone before exiting, be sure to re-boot your  computer.   You
  422.                           can  call SioDone even if SioReset has not been called, so it is
  423.                           good  practice  to  always  call  SioDone  before  exiting  your
  424.                           application.
  425.  
  426.                           Also  note  that  SioDone  dereferences the transmit and receive
  427.                           buffers set up by SioRxQue and SioTxQue.
  428.  
  429.                Returns    -2 : Port not enabled. Call SioReset first.
  430.                           -4 : No such port. Expect 0 to MaxPort.
  431.                            0 : OK.
  432.  
  433.               See Also    SioReset.
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.               +-------------+------------------------------------------------------------+
  443.               |    SioDSR   |  Reads the Data Set Ready (DSR) modem status bit.          |
  444.               +-------------+------------------------------------------------------------+
  445.  
  446.  
  447.                 Syntax    function SioDSR(Port:Integer):Integer;
  448.                           (* Port: Port selected (COM1 thru COM20) *)
  449.  
  450.                Remarks    The SioDSR function is used to read the  Data  Set  Ready  (DSR)
  451.                           modem status bit.
  452.  
  453.                Returns    -2 : Port not enabled. Call SioReset first.
  454.                           -4 : No such port.  Expect 0 to MaxPort.
  455.                            0 : DSR is clear.
  456.                           >0 : DSR is set
  457.  
  458.               See Also    SioCTS, SioRI, SioDCD, and SioModem
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.              PCL4P Reference Manual                                            Page 7
  477.               +-------------+------------------------------------------------------------+
  478.               |    SioDTR   |  Set, clear, or read Data Terminal Ready (DTR) status bit. |
  479.               +-------------+------------------------------------------------------------+
  480.  
  481.  
  482.                 Syntax    function SioDTR(Port:Integer;Cmd Char):Integer;
  483.                           (* Port: Port selected (COM1 thru COM20) *)
  484.                           (* Cmd:  DTR command (SET, CLEAR, or READ) *)
  485.  
  486.                Remarks    The SioDTR function controls the Data Terminal Ready (DTR) bit
  487.                           in the modem control register.  DTR should always  be  set  when
  488.                           communicating with a modem. Commands (defined in PCL4P.PAS) are:
  489.  
  490.                           SET_LINE ('S')  to set DTR (ON)
  491.                           CLEAR_LINE ('C')  to clear DTR (OFF)
  492.                           READ_LINE ('R')  to read DTR
  493.  
  494.                Returns    -2 : Port not enabled. Call SioReset first.
  495.                           -4 : No such port. Expect 0 to MaxPort.
  496.                           -5 : Not one of 'S', 'C', or 'R'.
  497.                            0 : DTR is OFF (READ_LINE Command).
  498.                           >0 : DTR is ON (READ_LINE Command).
  499.  
  500.               See Also    SioRTS.
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.               +-------------+------------------------------------------------------------+
  510.               |   SioError  |  Displays error in text.                                   |
  511.               +-------------+------------------------------------------------------------+
  512.  
  513.  
  514.                 Syntax    function SioError(Code:Integer):Integer;
  515.                           (* Code: PCL4P error code *)
  516.  
  517.                Remarks    The SioError function displays the error in  text  corresponding
  518.                           to  the  error  code  returned  from  a  PCL4P  function. During
  519.                           development of a communications application, it is a  good  idea
  520.                           to  always  test  return codes, and print out their descriptions
  521.                           with SioError.
  522.  
  523.                Returns    zero.
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.              PCL4P Reference Manual                                            Page 8
  545.               +-------------+------------------------------------------------------------+
  546.               |   SioFIFO   |  Sets the FIFO trigger level (16550 UART only).            |
  547.               +-------------+------------------------------------------------------------+
  548.  
  549.  
  550.                 Syntax    function SioFIFO(Port,LevelCode:Integer):Integer;
  551.                           (* Port:      Port selected (COM1 thru COM20) *)
  552.                           (* LevelCode: FIFO level code (see below) *)
  553.  
  554.                Remarks    The SioFIFO function  is  used to enable both transmit & receive
  555.                           FIFOs for 16550 UARTS, and to set the  trigger  level  at  which
  556.                           receive interrupts are generated.
  557.  
  558.                           For  example, if the FIFO level is set to 8, then the 16550 UART
  559.                           will not generate an interrupt until 8 bytes have been received.
  560.                           This reduces the number of interrupts  generated.  In  order  to
  561.                           take  advantage  of  the  TX FIFO, use the PCL4P library with TX
  562.                           interrupts enabled (DEFAULT).
  563.  
  564.                           In order to test if your port is a 16550 UART, call SioFIFO with
  565.                           a LevelCode of other than FIFO_OFF. SioFIFO can  be  called  for
  566.                           the 8250 and 16450 UART without ill effect.
  567.  
  568.                           Code    PCL4P.PAS    Trigger Level
  569.                           -1      FIFO_OFF     Disable FIFO
  570.                            0      LEVEL_1      1 byte
  571.                            1      LEVEL_4      4 bytes
  572.                            2      LEVEL_8      8 bytes
  573.                            3      LEVEL_14     14 bytes
  574.  
  575.                Returns    -2 : Port not enabled. Call SioReset first.
  576.                           -4 : No such port.  Expect 0 to MaxPort.
  577.                           >0 : FIFO level set.
  578.                            0 : FIFO level not set (not a 16550).
  579.  
  580.               +------------+-------------------------------------------------------------+
  581.               |   SioFlow  |  Sets hardware (RTS/CTS) flow control.                      |
  582.               +------------+-------------------------------------------------------------+
  583.  
  584.  
  585.                 Syntax    function SioFlow(Port,Tics:Integer)
  586.                           (* Port: Port selected (COM1 thru COM20) *)
  587.                           (* Tics: # tics before TX times out *)
  588.  
  589.                Remarks    The SioFlow function is used to enable or disable hardware  flow
  590.                           control.  Hardware flow control uses RTS and CTS to control data
  591.                           flow  between  the  modem and the computer.  Refer to the User's
  592.                           Manual  for  a  discussion  of flow control.  To enable hardware
  593.                           flow control, call SioFlow with Tics > 0.
  594.  
  595.                           "Tics" is the number of timer tics (18.2 / second) before a call
  596.                           to SioPutc or SioPuts will time out because CTS was not set.
  597.  
  598.                           In order for hardware flow control to work correctly, your modem
  599.                           must  also be configured to work with hardware flow control, and
  600.                           your computer to  modem  cable  must  have  RTS  and  CTS  wired
  601.                           straight  through.  If  you enable hardware flow control, do not
  602.                           modify the RTS line (by calling SioRTS). To  explicitly  disable
  603.                           hardware flow control, call SioFlow with Tics = -1.
  604.  
  605.                Returns    -2 : Port not enabled. Call SioReset first.
  606.                           -4 : No such port.  Expect 0 to MaxPort.
  607.                           =0 : Flow control disabled.
  608.                           >0 : Flow control enabled.
  609.  
  610.               See Also    SioPutc
  611.  
  612.              PCL4P Reference Manual                                            Page 9
  613.               +------------+-------------------------------------------------------------+
  614.               |   SioGetc  |  Reads the next character from the serial line.             |
  615.               +------------+-------------------------------------------------------------+
  616.  
  617.  
  618.                 Syntax    function SioGetc(Port,Tics:Integer):Integer;
  619.                           (* Port: Port selected (COM1 thru COM20) *)
  620.                           (* Tics: Timeout *)
  621.  
  622.                Remarks    The SioGetc function reads a byte from the selected serial port.
  623.                           The function will wait for the number of system  tics  given  by
  624.                           the  'Tics'  argument  before  returning 'timed out'.  There are
  625.                           18.2 tics to the second.
  626.  
  627.                Returns    -2 : Port not enabled. Call SioReset first.
  628.                           -4 : No such port. Expect 0 to MaxPort.
  629.                           -1 : If timed out.
  630.                           >0 : Character read.
  631.  
  632.               See Also    SioUnGetc and SioPutc.
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.               +---------------+----------------------------------------------------------+
  649.               |   SioGetDiv   |  Reads the baud rate divisor.                            |
  650.               +---------------+----------------------------------------------------------+
  651.  
  652.  
  653.                 Syntax    function SioGetDiv(Port:Integer):Integer;
  654.                           (* Port: Port selected (COM1 thru COM20) *)
  655.  
  656.  
  657.                Remarks    The  SioGetDiv  function reads the baud rate divisor.  The baud
  658.                           rate can then be determined by the divisor:
  659.  
  660.                           Baud   Divisor      Baud  Divisor      Baud  Divisor
  661.                            300    0180        4800   0018       38400   0003
  662.                           1200    0060        9600   000C       57600   0002
  663.                           2400    0030       19200   0006      115200   0001
  664.  
  665.                Returns    -2 : Port not enabled. Call SioReset first.
  666.                           -4 : No such port. Expect 0 to MaxPort.
  667.                           >0 : Baud rate divisor.
  668.  
  669.               See Also    SioParms.
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.              PCL4P Reference Manual                                            Page 10
  681.               +-------------+------------------------------------------------------------+
  682.               |   SioInfo   |  Returns PCL4P library information.                        |
  683.               +-------------+------------------------------------------------------------+
  684.  
  685.  
  686.                 Syntax    function SioInfo(Cmd:Char):Integer;
  687.                           (* Cmd: See table below *)
  688.  
  689.                Remarks    The  SioInfo  function  returns  a  word  value depending on the
  690.                           character argument Cmd in the table  below.   This  function  is
  691.                           usefull for understanding what the hardware is doing.  Note that
  692.                           the command argument is case sensitive.
  693.  
  694.  
  695.                Returns    Cmd
  696.  
  697.                           'V' : Version [as hex byte XY where means version X.Y]
  698.                           'I' : TRUE if library compiled with TX interrupts enabled.
  699.                           'P' : TRUE if library compiled for protected mode.
  700.                           'T' : Total (over all ports) transmitter interrupts.
  701.                           'R' : Total (over all ports) receiver interrupts.
  702.                           'd' : Total (over all ports) times RTS dropped.
  703.                           'r' : Total (over all ports) times RTS raised.
  704.                           'c' : Total (over all ports) times CTS drop detected.
  705.  
  706.  
  707.  
  708.               +-------------+------------------------------------------------------------+
  709.               |    SioIRQ   |  Assigns an IRQ line to a port.                            |
  710.               +-------------+------------------------------------------------------------+
  711.  
  712.  
  713.                 Syntax    function SioIRQ(Port,IRQcode:Integer):Integer;
  714.                           (* Port:    Port selected (COM1 thru COM20) *)
  715.                           (* IRQcode: IRQ number [IRQ2..IRQ15] *)
  716.  
  717.                Remarks    The SioIRQ function assigns an IRQ line to  a  port.   That  is,
  718.                           SioIRQ  maps  an  IRQ  to a port.  SioIRQ (like SioUART) must be
  719.                           called before calling SioReset. Unless you have  a  non-standard
  720.                           (COM1  &  COM3  use IRQ4 while COM2 & COM4 use IRQ3) serial port
  721.                           configuration  (or  don't  want  to  run  more  than   2   ports
  722.                           concurrently),  you  will not need to call SioIRQ.  Be EXTREMELY
  723.                           careful with SioIRQ as it can lock  your  machine  up  if  given
  724.                           incorrect information.
  725.  
  726.                           In particular, remember that your port  hardware  must  generate
  727.                           the interrupt that you have specified.  You should refer to your
  728.                           serial   board  hardware  manual  for  specfic  instructions  in
  729.                           configuring your hardware.  Be sure to call  SioPorts  first  to
  730.                           setup  DigiBoard  or  BOCA  ports if you have them. Refer to the
  731.                           PCL4P Users Manual for additional information.
  732.  
  733.                Returns    -4 : No such port. Expect 0 to MaxPort.
  734.                          -15 : Port already enabled.  SioReset has already been called.
  735.                          |17 : No such IRQ.
  736.                          -18 : ISR limit (maximum of 4 PC IRQs) exceeded.
  737.                            0 : Otherwise
  738.  
  739.               See Also    SioUART and SioPorts.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.              PCL4P Reference Manual                                            Page 11
  749.  
  750.               +-------------+------------------------------------------------------------+
  751.               |   SioLine   |  Reads the line status register.                           |
  752.               +-------------+------------------------------------------------------------+
  753.  
  754.  
  755.                 Syntax    function SioLine(Port:Integer):Integer;
  756.                           (* Port: Port selected (COM1 thru COM20) *)
  757.  
  758.                Remarks    The  SioLine  function  reads  the  line  status  register.  The
  759.                           individual bit masks are as follows:
  760.  
  761.                           0x40  = Transmitter empty.
  762.                           0x20  = Transmitter buffer empty.
  763.                           0x10  = Break detected.
  764.                           0x08  = Framming error.
  765.                           0x04  = Parity error.
  766.                           0x02  = Overrun error.
  767.                           0x01  = Data ready.
  768.  
  769.                           The above are documented in the file PCL4P.PAS.
  770.  
  771.                Returns    -2 : Port not enabled. Call SioReset first.
  772.                           -4 : No such port. Expect 0 to MaxPort.
  773.                           >0 : Line status (rightmost byte of word).
  774.  
  775.               See Also    SioModem.
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.               +-------------+------------------------------------------------------------+
  783.               | SioLoopBack |  Does a UART loopback test.                                |
  784.               +-------------+------------------------------------------------------------+
  785.  
  786.  
  787.                 Syntax    function SioLoopBack(Port:Integer):Integer;
  788.                           (* Port: Port selected (COM1 thru COM20) *)
  789.  
  790.                Remarks    SioLoopBack makes use of the built in loopback  test  capability
  791.                           of  the  INS8250  family  UART.  Normally SioLoopBack will never
  792.                           need to be called unless you suspect that your UART is bad. Many
  793.                           UARTs must be reset after running a loopback test.
  794.  
  795.                Returns      0 : Loopback test is successfull.
  796.                            -2 : Port not enabled. Call SioReset first.
  797.                            -4 : No such port.  Expect 0 to MaxPort.
  798.                           -12 : Loopback test fails.
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.              PCL4P Reference Manual                                            Page 12
  817.               +-------------+------------------------------------------------------------+
  818.               |   SioModem  |  Reads the modem status register.                          |
  819.               +-------------+------------------------------------------------------------+
  820.  
  821.  
  822.                 Syntax    function SioModem(Port,Mask:Integer):Integer;
  823.                           (* Port: Port selected (COM1 thru COM20) *)
  824.                           (* Mask: Modem function mask *)
  825.  
  826.                Remarks    The  SioModem  function  reads  the  modem  register.    The bit
  827.                           definitions for the function mask are as follows:
  828.  
  829.                           Bit Name  Function               Bit  Name      Function
  830.                            7  DCD   Data Carrier Detect     3   DeltaDCD  DCD has changed
  831.                            6  RI    Ring Indicator          2   DeltaRI   RI has changed
  832.                            5  DSR   Data Set Ready          1   DeltaDSR  DSR has changed
  833.                            4  CTS   Clear To Send           0   DeltaCTS  CTS has changed
  834.  
  835.                           Bits  4  through  7  represent  the  absolute  state  of   their
  836.                           respective  RS-232  inputs.  Bits 0 through 3 represent a change
  837.                           in the state of their respective RS-232 inputs since last  read.
  838.                           Once UART register 3 is read, the Delta bits are cleared.  Thus,
  839.                           it is best not to depend on the Delta bits.
  840.  
  841.  
  842.                Returns    -2 : Port not enabled. Call SioReset first.
  843.                           -4 : No such port. Expect 0 to MaxPort.
  844.                           >0 : Modem status (rightmost byte of word).
  845.  
  846.               See Also   SioCTS, SioDCD, SioDSR and SioRI.
  847.  
  848.  
  849.               +-------------+------------------------------------------------------------+
  850.               |  SioParms   |  Sets parity, stop bits, and word length.                  |
  851.               +-------------+------------------------------------------------------------+
  852.  
  853.  
  854.                Syntax     int  SioParms(Port,Parity,StopBits,DataBits:Integer):Integer;
  855.                           (* Port:     Port selected (COM1 thru COM20) *)
  856.                           (* Parity:   Parity code [0,1,2] *)
  857.                           (* StopBits: Stop bits code [0,1] *)
  858.                           (* DataBits: Word length code [0,1,2,3] *)
  859.  
  860.                Remarks    The SioParms function sets  the  parity,  stop  bits,  and  word
  861.                           length.   If  the  default parity (none), stop bits (1), or word
  862.                           length (8) is not  acceptable,  then  they  can  be  changed  by
  863.                           calling SioParms.  SioParms can be called either before or after
  864.                           calling SioReset. See file PCL4P.PAS. (8 = default)
  865.  
  866.                                         Value   Description    PCL4P.PAS
  867.                           ParityCode:    *0      no parity      NoParity
  868.                                           1      odd parity     OddParity
  869.                                           3      even parity    EvenParity
  870.                           StopBitsCode:  *0      1 stop bit     OneStopBit
  871.                                           1      2 stop bits    TwoStopBits
  872.                           WordLengthCode: 0      5 data bits    WordLength5
  873.                                           1      6 data bits    WordLength6
  874.                                           2      7 data bits    WordLength7
  875.                                          *3      8 data bits    WordLength8
  876.  
  877.               Returns     -4 : No such port. Expect 0 to MaxPort.
  878.                           -7 : Bad parity code selected. Expecting  0 to 2.
  879.                           |8 : Bad stop bits code. Expecting  0 or 1.
  880.                           -9 : Bad word length code. Expecting  0 to 3.
  881.  
  882.              See Also    SioReset.
  883.  
  884.              PCL4P Reference Manual                                            Page 13
  885.               +-------------+------------------------------------------------------------+
  886.               |  SioPorts   |  Sets number of PC & Digiboard / BOCA Board ports.         |
  887.               +-------------+------------------------------------------------------------+
  888.  
  889.  
  890.                 Syntax    function SioPorts(NbrPorts,FirstPort,StatusReg,Code:Integer)
  891.                                      :Integer;
  892.                           (* NbrPorts:  Total number of ports *)
  893.                           (* FirstPort: First DigiBoard or BOCA port *)
  894.                           (* StatusReg: DigiBoard Status Register *)
  895.                           (* Code:      PC_PORTS, DIGIBOARD, or BOCABOARD *)
  896.  
  897.                Remarks    The SioPorts function must be called  before  ANY  other  serial
  898.                           functions.   The  purpose of the SioPorts function is to set the
  899.                           total number of ports, the first DigiBoard (or BOCA board)  port
  900.                           and the DigiBoard (or BOCA board) status register address.
  901.  
  902.                           Once SioPorts is called, all COM ports starting with "FirstPort"
  903.                           will be treated as DigiBoard (or BOCA board) ports.  The default
  904.                           setup is 4 standard PC ports and no DigiBoard or  BOCA  ports  [
  905.                           SioPorts(4,4,0,PC_PORTS) ].
  906.  
  907.                           Refer  to  ther  PCL4P users maniual for more information on the
  908.                           DigiBoard and BOCA board.
  909.  
  910.                Returns    -4 : No such port. Expect 0 to 9.
  911.                           0 : No error (sets MaxPort to NumberPorts-1).
  912.  
  913.               See Also    SioUART, SioIRQ, and Code Examples.
  914.  
  915.  
  916.  
  917.               +-------------+------------------------------------------------------------+
  918.               |   SioPutc   |  Transmit a character over a serial line.                  |
  919.               +-------------+------------------------------------------------------------+
  920.  
  921.  
  922.                 Syntax    function SioPutc(Port:Integer;Ch:Char):Integer;
  923.                           (* Port: Port selected (COM1 thru COM20) *)
  924.                           (* Ch:   Character to send *)
  925.  
  926.                Remarks    The SioPutc function transmits one character  over the  selected
  927.                           serial line.
  928.  
  929.                           If  flow  control has been enabled, then SioPutc may return a -1
  930.                           (time out) if the  number  of  tics  specified  in  the  SioFlow
  931.                           function was exceeded waiting for the modem to raise CTS.
  932.  
  933.                           Refer to the User's Manual for a discussion of flow control.
  934.  
  935.                           If  transmitter  interrupts  are  enabled  (there  are  separate
  936.                           versions of the library  for  transmitter  interrupts  enabled),
  937.                           then  the  byte  is  placed  in  the  transmit  buffer, awaiting
  938.                           transmission by the PCL4P interrupt service routine.
  939.  
  940.                Returns    -2 : Port not enabled. Call SioReset first.
  941.                           -4 : No such port. Expect 0 to MaxPort.
  942.                           -1 : Timed out waiting for CTS (flow control enabled)
  943.  
  944.               See Also    SioGetc and SioFlow.
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.              PCL4P Reference Manual                                            Page 14
  953.               +-------------+------------------------------------------------------------+
  954.               |   SioRead   |  Reads any UART register.                                  |
  955.               +-------------+------------------------------------------------------------+
  956.  
  957.  
  958.                 Syntax    function SioRead(Port,Reg:Integer):Integer;
  959.                           (* Port: Port selected (COM1 thru COM20) *)
  960.                           (* Reg:  UART register (0 to 7) *)
  961.  
  962.                Remarks    The SioReset function directly reads the contents of any of  the
  963.                           7  UART  registers.   This  function  is  useful  when debugging
  964.                           application  programs  and  as  a  method  for  verifying   UART
  965.                           contents.   Refer  to the PCL4P Users Manual for a discussion of
  966.                           the 7 UART registers.
  967.  
  968.                           The line status register (register 5)  can  also  be  read  with
  969.                           SioLine while the modem status register (register 6) can also be
  970.                           read  with  SioModem.  Refer  to  the  PCL4P User's Manual for a
  971.                           discussion of the UART registers.
  972.  
  973.                Returns     -3 : No buffer available. Call SioRxBuf first.
  974.                            -4 : No such port. Expect 0 to MaxPort.
  975.  
  976.               See Also    SioLine and SioModem.
  977.  
  978.  
  979.  
  980.               +-------------+------------------------------------------------------------+
  981.               |  SioReset   |  Initialize a serial port for processing.                  |
  982.               +-------------+------------------------------------------------------------+
  983.  
  984.  
  985.                 Syntax    function SioReset(Port,BaudCode:Integer):Integer;
  986.                           (* Port:     Port selected (COM1 thru COM20) *)
  987.                           (* BaudCode: Baud code or -1 *)
  988.  
  989.                Remarks    The SioReset function  initializes  the  selected  serial  port.
  990.                           SioReset should be called after calling SioParm and SioRxBuf but
  991.                           before  making  any  other  calls  to  PCL4P.  SioReset uses the
  992.                           parity, stop bits, and  word  length  value  previously  set  if
  993.                           SioParm  was  called, otherwise the default values (see SioParm)
  994.                           are used.
  995.  
  996.                           Recall that COM1 and COM3 share the same  interrupt  vector  and
  997.                           therefore  cannot  operate  simultaneously. Similiarly, COM2 and
  998.                           COM4 cannot operate simultaneously. Any other combination of two
  999.                           ports can be used.
  1000.  
  1001.                           By specifing NORESET (-1) for the baud rate code, the port  will
  1002.                           NOT  be  reset.   This is used to "take over" a port from a host
  1003.                           communications program that allows a  "DOS  gateway".   External
  1004.                           protocols  can  be implemented this way.  See SioBaud for a list
  1005.                           of the baud rate codes, or see "PCL4P.PAS".
  1006.  
  1007.                Returns     -3 : No buffer available. Call SioRxBuf first.
  1008.                            -4 : No such port. Expect 0 to MaxPort.
  1009.                           -11 : Bad baud rate code selected. Expecting  0 to 9.
  1010.                           |13 : UART undefined.  SioUART(Port,0) was called previously.
  1011.                           |14 : Bad or missing UART.  You may not have hardware present.
  1012.                           |15 : Port already enabled.  SioReset has already been called.
  1013.                           -16 : Interrupt already in use.
  1014.  
  1015.               See Also    SioBaud, SioParms, SioRxBuf, SioDone, and SioUART.
  1016.  
  1017.  
  1018.  
  1019.  
  1020.              PCL4P Reference Manual                                            Page 15
  1021.               +-------------+------------------------------------------------------------+
  1022.               |    SioRI    |  Reads the Ring Indicator (RI) modem status bit.           |
  1023.               +-------------+------------------------------------------------------------+
  1024.  
  1025.  
  1026.                 Syntax    function SioRI(Port:Integer):Integer;
  1027.                           (* Port: Port selected (COM1 thru COM20) *)
  1028.  
  1029.                Remarks    The SioRI function is used to read the Ring  Indicator
  1030.                           (RI) modem status bit. Also see SioModem.
  1031.  
  1032.                Returns    -2 : Port not enabled. Call SioReset first.
  1033.                           -4 : No such port.  Expect 0 to MaxPort.
  1034.                            0 : RI is clear.
  1035.                           >0 : RI is set (RING has occurred).
  1036.  
  1037.               See Also    SioDSR, SioCTS, SioDCD, and SioModem.
  1038.  
  1039.  
  1040.  
  1041.  
  1042.               +-------------+------------------------------------------------------------+
  1043.               |    SioRTS   |  Sets, clears, or reads the Request to Send (RTS) line.    |
  1044.               +-------------+------------------------------------------------------------+
  1045.  
  1046.  
  1047.                 Syntax    function SioRTS(Port:Integer;Cmd:Char):Integer;
  1048.                           (* Port: Port selected (COM1 thru COM20) *)
  1049.                           (* Cmd:  RTS command (SET, CLEAR, or READ) *)
  1050.  
  1051.                Remarks    The SioRTS function controls the Request to Send (RTS bit in the
  1052.                           modem control register.
  1053.  
  1054.                           The  RTS  line  is  used  by  some  error  correcting  modems to
  1055.                           implement hardware flow control.  RTS is dropped by the computer
  1056.                           to signal the modem not to send data, and is  raised  to  signal
  1057.                           the modem to continue. RTS should be set when communicating with
  1058.                           a modem unless Flow Control is being used.
  1059.  
  1060.                           Refer  to  the  User's  Manual for a discussion of flow control.
  1061.                           Commands (defined in PCL4P.PAS) are:
  1062.  
  1063.                           SET_LINE ('S')   - set RTS (ON)
  1064.                           CLEAR_LINE ('C') | clear RTS (OFF)
  1065.                           READ_LINE ('R')  - read RTS
  1066.  
  1067.                Returns    -2 : Port not enabled. Call SioReset first.
  1068.                           -4 : No such port. Expect 0 to MaxPort.
  1069.                           -5 : Command is not one of 'S', 'C', or 'R'.
  1070.                            0 : RTS is OFF (READ_LINE Command).
  1071.                           >0 : RTS is ON  (READ_LINE Command).
  1072.  
  1073.               See Also    SioFlow and SioDTR.
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.              PCL4P Reference Manual                                            Page 16
  1089.               +------------+-------------------------------------------------------------+
  1090.               |  SioRxBuf  |  Sets up receive buffers.                                   |
  1091.               +------------+-------------------------------------------------------------+
  1092.  
  1093.  
  1094.                 Syntax    function SioRxBuf(Port,Selector,SizeCode:Integer):Integer;
  1095.                           (* Port:     Port selected (COM1 thru COM20) *)
  1096.                           (* SegPtr:   Receive buffer segment pointer *)
  1097.                           (* SizeCode: Buffer size code *)
  1098.  
  1099.                Remarks     The  SioRxBuf  function passes the address selector and size of
  1100.                           the receive buffer to  PCL4P.   Recall  that  PCL4P  requires  a
  1101.                           receive buffer for each port in simultaneous operation since the
  1102.                           receive  function is interrupt driven.  It must be called before
  1103.                           any incoming characters can be received. SioRxBuf must be called
  1104.                           before SioReset.  Buffer size codes are listed in "PCL4P.PAS".
  1105.  
  1106.                           Size Code       Buffer Size    PCL4P.PAS
  1107.                              4            128 bytes        Size128
  1108.                              5            256 bytes        Size256
  1109.                              6            512 bytes        Size512
  1110.                              7           1024 bytes        Size1024 or Size1K
  1111.                              8           2048 bytes        Size2048 or Size2K
  1112.                              9           4096 bytes        Size4096 or Size4K
  1113.                             10           8192 bytes        Size8192 or Size8K
  1114.                             11          16384 bytes        Size16384 or Size16K
  1115.                             12          32768 bytes        Size32768 or Size32K
  1116.  
  1117.                Returns    -4 : No such port. Expect 0 to MaxPort.
  1118.                          -10 : Bad buffer size code. Expecting 0 to 11.
  1119.  
  1120.               See Also    SioReset and Code Examples.
  1121.  
  1122.  
  1123.  
  1124.  
  1125.               +------------+-------------------------------------------------------------+
  1126.               | SioRxClear |  Clears the receive buffer.                                 |
  1127.               +------------+-------------------------------------------------------------+
  1128.  
  1129.  
  1130.                 Syntax    function SioRxClear(Port:Integer):Integer;
  1131.                           (* Port: Port selected (COM1 thru COM20) *)
  1132.  
  1133.                Remarks    The SioRxClear  function  will  delete  any  characters  in  the
  1134.                           receive  buffer  for  the  specified port.  After execution, the
  1135.                           receive buffer will be empty.  Call SioRxClear after resetting a
  1136.                           port in order to delete any spurious characters.
  1137.  
  1138.                           Note that this function was renamed from SioRxFlush in  previous
  1139.                           versions.
  1140.  
  1141.                Returns    -2 : Port not enabled. Call SioReset first.
  1142.                           -4 : No such port. Expect 0 to MaxPort.
  1143.  
  1144.               See Also    SioRxQue.
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.              PCL4P Reference Manual                                            Page 17
  1157.               +-------------+------------------------------------------------------------+
  1158.               |  SioRxQue   |  Returns the number of bytes in the receive queue.         |
  1159.               +-------------+------------------------------------------------------------+
  1160.  
  1161.  
  1162.                 Syntax    function SioRxQue(Port:Integer):Integer;
  1163.                           (* Port: Port selected (COM1 thru COM20) *)
  1164.  
  1165.                Remarks    The  SioRxQue  function  will return the number of characters in
  1166.                           the receive queue at the time of the call. It  can  be  used  to
  1167.                           implement XON/XOFF flow control.
  1168.  
  1169.                Returns    -2 : Port not enabled. Call SioReset first.
  1170.                           -4 : No such port. Expect 0 to MaxPort.
  1171.  
  1172.               See Also     SioRxFlush.
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.               +------------+-------------------------------------------------------------+
  1190.               |  SioTimer  |  Returns the number of system clock tics since midnight.    |
  1191.               +------------+-------------------------------------------------------------+
  1192.  
  1193.  
  1194.                 Syntax    function SioTimer:LongInt;
  1195.  
  1196.                Remarks    The  SioTimer  function will return the number of  system  clock
  1197.                           tics since midnight, at 18.2065 tics per second.  This  function
  1198.                           is usefull for timing various functions.
  1199.  
  1200.               See Also    SioDelay
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.              PCL4P Reference Manual                                            Page 18
  1225.               +------------+-------------------------------------------------------------+
  1226.               |  SioTxBuf  |  Sets up transmitter buffer.                                |
  1227.               +------------+-------------------------------------------------------------+
  1228.  
  1229.  
  1230.                 Syntax    function SioTxBuf(Port,Selector,SizeCode:Integer):Integer;
  1231.                           (* Port:     Port selected (COM1 thru COM20) *)
  1232.                           (* SegPtr:   Transmit buffer segment pointer *)
  1233.                           (* SizeCode: Buffer size code *)
  1234.  
  1235.                           int Port;     (* Port selected (COM1 thru COM20) *)
  1236.                           char *Buffer; (* Transmit buffer *)
  1237.                           int SizeCode; (* Buffer size code *)
  1238.  
  1239.                Remarks    The  SioTxBuf  function passes the address selector and  size of
  1240.                           the transmit buffer to PCL4P, provided that you will link with a
  1241.                           PCL4P  library  with  transmitter  interrupts  enabled.    PCL4P
  1242.                           requires  a  transmit  buffer  for  each  port  in  simultaneous
  1243.                           operation if you are using  the  version  of  the  library  with
  1244.                           transmitter  interrupts  enabled  (default).   SioTxBuf  must be
  1245.                           called before SioReset.
  1246.  
  1247.                           Size Code       Buffer Size    PCL4P.PAS
  1248.                              4            128 bytes        Size128
  1249.                              5            256 bytes        Size256
  1250.                              6            512 bytes        Size512
  1251.                              7           1024 bytes        Size1024 or Size1K
  1252.                              8           2048 bytes        Size2048 or Size2K
  1253.                              9           4096 bytes        Size4096 or Size4K
  1254.                             10           8192 bytes        Size8192 or Size8K
  1255.                             11          16384 bytes        Size16384 or Size16K
  1256.                             12          32768 bytes        Size32768 or Size32K
  1257.  
  1258.                           This function is not used unless the transmitter interrupts  are
  1259.                           enabled   (default).   Refer  to  the  PCL4P  Users  Manual  for
  1260.                           information on transmitter (TX) interrupts.
  1261.  
  1262.                Returns     -4 : No such port. Expect 0 to MaxPort.
  1263.                           -10 : Bad buffer size code. Expecting 0 to 11.
  1264.  
  1265.               See Also    SioRxBuf, SioReset and Code Examples.
  1266.  
  1267.  
  1268.               +------------+-------------------------------------------------------------+
  1269.               | SioTxClear |  Clears the transmitter buffer.                             |
  1270.               +------------+-------------------------------------------------------------+
  1271.  
  1272.  
  1273.                 Syntax    function SioTxClear(Port:Integer):Integer;
  1274.                           (* Port: Port selected (COM1 thru COM20) *)
  1275.  
  1276.                Remarks    The SioTxClear  function  will  delete  any  characters  in  the
  1277.                           transmit  buffer  for the specified port, provided that you will
  1278.                           link with a PCL4P library with transmitter  interrupts  enabled.
  1279.                           After execution, the transmit buffer will be empty.
  1280.  
  1281.                           Once  this  function is called, any character  in  the  transmit
  1282.                           buffer  (put  there  by  SioPutc) will be lost and therefore not
  1283.                           transmitted. This function is not used  unless  the  transmitter
  1284.                           interrupts  are  enabled  Refer  to  the  PCL4P Users Manual for
  1285.                           information on transmitter (TX) interrupts.
  1286.  
  1287.                Returns    -2 : Port not enabled. Call SioReset first.
  1288.                           -4 : No such port. Expect 0 to MaxPort.
  1289.                            0 : OK.
  1290.               See Also    SioTxQue.
  1291.  
  1292.              PCL4P Reference Manual                                            Page 19
  1293.               +------------+-------------------------------------------------------------+
  1294.               | SioTxFlush |  Flushes the transmitter buffer.                            |
  1295.               +------------+-------------------------------------------------------------+
  1296.  
  1297.  
  1298.                 Syntax    function SioTxFlush(Port:Integer):Integer;
  1299.                           (* Port: Port selected (COM1 thru COM20) *)
  1300.  
  1301.                Remarks    The SioTxFlush function will re-enable transmitter interrupts if
  1302.                           they  had  been disabled by CTS dropping. This has the effect of
  1303.                           forcing the transmission of all data in the transmitter queue.
  1304.  
  1305.                           Note that this function will not return  until  the  transmitter
  1306.                           queue is empty.
  1307.  
  1308.                Returns    -2 : Port not enabled. Call SioReset first.
  1309.                           -4 : No such port. Expect 0 to MaxPort.
  1310.                            0 : OK.
  1311.  
  1312.               See Also    SioTxQue.
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.               +------------+-------------------------------------------------------------+
  1320.               |  SioTxQue  |  Returns the number of bytes in the transmit queue.         |
  1321.               +------------+-------------------------------------------------------------+
  1322.  
  1323.  
  1324.                 Syntax    function SioTxQue(Port:Integer):Integer;
  1325.                           (* Port: Port selected (COM1 thru COM20) *)
  1326.  
  1327.                Remarks    The SioTxQue function will return the number  of  characters  in
  1328.                           the  transmit  queue  at the time of the call, provided that you
  1329.                           will link with  a  PCL4P  library  with  transmitter  interrupts
  1330.                           enabled.
  1331.  
  1332.                           This function is not used unless the transmitter interrupts  are
  1333.                           enabled.  Refer  to  the  PCL4P  Users Manual for information on
  1334.                           transmitter (TX) interrupts.
  1335.  
  1336.                Returns    -2 : Port not enabled. Call SioReset first.
  1337.                           -4 : No such port. Expect 0 to MaxPort.
  1338.                           >=0: Number bytes in transmit queue.
  1339.  
  1340.               See Also     SioTxFlush.
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.              PCL4P Reference Manual                                            Page 20
  1361.               +------------+-------------------------------------------------------------+
  1362.               |  SioUART   |  Sets the UART base address.                                |
  1363.               +------------+-------------------------------------------------------------+
  1364.  
  1365.  
  1366.                 Syntax    function SioUART(Port,Address:Integer):Integer;
  1367.                           (* Port:    Port selected (COM1 thru COM20) *)                           int Port;     (* COM1 to COM4 *)
  1368.                           (* Address: UART address *)
  1369.  
  1370.                Remarks    The  SioUART  function  sets  the  UART  base  address  for  the
  1371.                           specified port.  SioUART must be called before SioReset in order
  1372.                           to have effect.  Be extremely sure that you know  what  you  are
  1373.                           doing!   Note   that  PCL4P  uses  the  standard  PC/XT/AT  port
  1374.                           addresses,  interrupt  request  lines,  and  interrupt   service
  1375.                           vectors.   Therefore,   this   function   is   only  needed  for
  1376.                           non-standard ports.
  1377.  
  1378.                Returns    >0 : The previous base address for this port.
  1379.                           -4 : No such port.  Expect 0 to MaxPort.
  1380.                          -15 : Port already enabled.  SioReset has already been called.
  1381.  
  1382.               See Also    SioPorts, SioIRQ, and SioReset.
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.               +------------+-----+-------------------------------------------------------+
  1389.               | SioUnGetc  |  "Un|gets" the last character read with SioGetc.            |
  1390.               +------------+-----+-------------------------------------------------------+
  1391.  
  1392.  
  1393.                 Syntax    function SioUnGetc(Port:Integer;Ch:Char):Integer;
  1394.                           (* Port: Port selected (COM1 thru COM20) *)
  1395.                           (* Ch:   Character to unget *)
  1396.  
  1397.                Remarks    The SioUnGetc function returns  ("pushes")  the  character  back
  1398.                           into  the serial input buffer.  The character pushed will be the
  1399.                           next character returned by SioGetc.  Only one character  can  be
  1400.                           pushed back. This function works just like the "ungetc" function
  1401.                           in the C language.
  1402.  
  1403.                Returns    -2 : Port not enabled. Call SioReset first.
  1404.                           -4 : No such port. Expect 0 to MaxPort.
  1405.  
  1406.               See Also    SioReset.
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.              PCL4P Reference Manual                                            Page 21
  1429.                                        Function Sumary
  1430.  
  1431.  
  1432.                    36 functions
  1433.  
  1434.                    +-------------+----------+----------+----------+----------+
  1435.                    | Function    |   Arg1   |   Arg2   |   Arg3   |   Arg4   |
  1436.                    +-------------+----------+----------+----------+----------+
  1437.                    | SioBaud     | Port     | BaudCode |          |          |
  1438.                    | SioBrkKey   |          |          |          |          |
  1439.                    | SioBrkSig   | Port     | Cmd      |          |          |
  1440.                    | SioCTS      | Port     |          |          |          |
  1441.                    | SioDelay    | Tics     |          |          |          |
  1442.                    | SioDCD      | Port     |          |          |          |
  1443.                    | SioDone     | Port     |          |          |          |
  1444.                    | SioDSR      | Port     |          |          |          |
  1445.                    | SioDTR      | Port     | Cmd      |          |          |
  1446.                    | SioError    | Code     |          |          |          |
  1447.                    | SioFIFO     | Port     | LevelCode|          |          |
  1448.                    | SioFlow     | Port     | Tics     |          |          |
  1449.                    | SioGetc     | Port     | Tics     |          |          |
  1450.                    | SioGetDiv   | Port     |          |          |          |
  1451.                    | SioInfo     | Cmd      |          |          |          |
  1452.                    | SioIRQ      | Port     | IRQcode  |          |          |
  1453.                    | SioLine     | Port     |          |          |          |
  1454.                    | SioLoopBack | Port     |          |          |          |
  1455.                    | SioModem    | Port     | Mask     |          |          |
  1456.                    | SioParms    | Port     | Parity   | StopBits | DataBits |
  1457.                    | SioPorts    | NbrPorts | FirstDBP | StatusReg| Code     |
  1458.                    | SioPutc     | Port     | Ch       |          |          |
  1459.                    | SioRead     | Port     | Register |          |          |
  1460.                    | SioReset    | Port     | BaudCode |          |          |
  1461.                    | SioRI       | Port     |          |          |          |
  1462.                    | SioRTS      | Port     | Cmd      |          |          |
  1463.                    | SioRxBuf    | Port     | SegPtr   | SizeCode |          |
  1464.                    | SioRxClear  | Port     |          |          |          |
  1465.                    | SioRxQue    | Port     |          |          |          |
  1466.                    | SioTimer    |          |          |          |          |
  1467.                    | SioTxBuf    | Port     | SegPtr   | SizeCode |          |
  1468.                    | SioTxClear  | Port     |          |          |          |
  1469.                    | SioTxFlush  | Port     |          |          |          |
  1470.                    | SioTxQue    | Port     |          |          |          |
  1471.                    | SioUART     | Port     | Address  |          |          |
  1472.                    | SioUnGetc   | Port     | Ch       |          |          |
  1473.                    +-------------+----------+----------+----------+----------+
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.              PCL4P Reference Manual                                            Page 22
  1497.                                        Error Code Summary
  1498.  
  1499.  
  1500.               +------+--------------------------------------------------------+
  1501.               | Code |  Description                                           |
  1502.               +------+--------------------------------------------------------+
  1503.               |   0  |  No error.                                             |
  1504.               |  -1  |  Timeout waiting for I/O.                              |
  1505.               |  |2  |  Port not enabled. Call SioReset first.                |
  1506.               |  |3  |  No buffer available. Call SioRxBuf first.             |
  1507.               |  |4  |  No such port. Expect 0 to MaxPort. (COM1 = 0)         |
  1508.               |  |5  |  Expected 'S', 'C', or 'R' as 2nd argument.            |
  1509.               |  |6  |  Expected 'A', 'C', or 'D' as 2nd argument.            |
  1510.               |  |7  |  Bad parity code specified. Expected 0 to 7.           |
  1511.               |  |8  |  Bad stop bits code specified. Expected 0 or 1.        |
  1512.               |  -9  |  Bad wordlength code specified. Expect 0 to MaxPort.   |
  1513.               | -10  |  Bad buffer size code specified. Expected 0 to 11.     |
  1514.               | |11  |  Bad baud rate code. Expected 0 to 9.                  |
  1515.               | |12  |  Loopback test fails.                                  |
  1516.               | |13  |  UART undefined.                                       |
  1517.               | |14  |  Missing or bad UART. (no UART hardware ?)             |
  1518.               | |15  |  Port already enabled.                                 |
  1519.               | |16  |  ISR (interrupt) already in use.                       |
  1520.               | |17  |  No such IRQ. (Should be 2 to 15)                      |
  1521.               | |18  |  ISR limit (maximum of 4 PC IRQs) exceeded.            |
  1522.               +-+----+--------------------------------------------------------+
  1523.  
  1524.  
  1525.                                        Code Examples
  1526.  
  1527.  
  1528.               DigiBoard Example
  1529.  
  1530.               (*** Custom Configuration: DigiBoard PC/8 ***)
  1531.               WriteLn('[ Configuring for DigiBoard PC/8 (IRQ5) ]');
  1532.               SioPorts(8,COM1,$140,DIGIBOARD);
  1533.               for Port := COM1 to COM8 do
  1534.                 begin
  1535.                   (* set DigiBoard UART addresses *)
  1536.                   SioUART(Port,$100+8*Port);
  1537.                   (* set DigiBoard IRQ *)
  1538.                   SioIRQ(Port,IRQ5);
  1539.                 end;
  1540.  
  1541.               BOCA Board Example
  1542.  
  1543.               (*** Custom Configuration: BOCA BB2016 ***)
  1544.               WriteLn('[ Configuring for BOCA Board BB2016 (IRQ15) ]');
  1545.               SioPorts(20,COM5,$107,BOCABOARD);
  1546.               for Port := COM5 to COM20 do
  1547.                 begin
  1548.                   (* set BOCA Board UART addresses *)
  1549.                   SioUART(Port,$100+8*Port);
  1550.                   (* set BOCA Board IRQ *)
  1551.                   SioIRQ(Port,IRQ15);
  1552.                 end;
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.              PCL4P Reference Manual                                            Page 23
  1565.